<template>
  <div v-drag>
    <div class="mask"  @click="closePopup(false)"></div>
    <div class="edit_box" v-loading="loading">
      <div class="box_head">
        <p>取消订单</p>
        <i  @click="closePopup(false)"></i>
      </div>
      <div class="box_body cancel_box">
        <div class="line line_box">
          <span class="lab">原因：</span>
                      <el-radio-group v-model="reason">
                        <p>
                          <el-radio label="用户原因">用户原因</el-radio>
                          <el-radio label="仓库原因">仓库原因</el-radio>
                        </p>
                      <p>
                        <el-radio label="配送员原因">配送员原因</el-radio>
                        <el-radio label="其它原因">其它原因</el-radio>
                      </p>

                      </el-radio-group>
        </div>

        <div class="line">
          <span class="lab">备注：</span>
            <el-input type="textarea" placeholder="请输入备注信息" v-model.trim="remark"></el-input>
        </div>
      </div>
      <div class="box_foot">
        <span @click="closePopup(false)">取消</span>
        <span @click="sendInfo">确定</span>
      </div>
    </div>
  </div>
</template>

<script>
import {cancelSend} from "@/api/data/user/productSend";

export default {
  props:['recordId','warehouseId'],
  data(){
    return {
      sender: '',
      senderOption: '',
      infoTip: '',
      tip_num: '',
      loading:false,
      proStatus:1,
      reason:'用户原因',
      remark:''
    }
  },
  mounted() {
  },
  methods:{

    sendInfo(){
      let that = this;
      that.loading = true;
      let result = that.reason + (that.remark ?  (':' + that.remark) : '') ;
      let data = {
        recordNo: that.recordId,
        remark: result
      }
      cancelSend(data).then(response => {
        that.closePopup(true);
        that.$message.success({
          message:'操作成功！',
          duration:1500
        });
        that.loading = false;
      }).catch((e) => {
        that.loading = false;
      });
    },

    setTip(num,text){
      this.tip_num = num;
      this.infoTip = text
    },

    // 关闭
    closePopup(refresh){
      this.$emit('listenToChild', {refresh: refresh})
    }
  }
}
</script>
<style>
.line_box .el-radio {
  width:40% !important;
}
</style>
<style scoped>
.cancel_box .line_box p:nth-of-type(2){
  margin-top:15px;
}
.cancel_box .lab {
  width: 100px;
}
</style>

